const state = {

    currentUserId: null,    // 用户id
    userToken: null,    // 用户令牌
    username: null,     //用户名
    permissions:[],     //用户权限
}

const mutations = {
    SET_CURRENT_USER(state, {userId, token,permissions, username}) {
        state.currentUserId = userId
        state.userToken = token
        state.permissions = permissions
        state.username = username
        localStorage.setItem(userId, token)
    }
}

const actions = {}

const getters = {}

export default ({
    namespaced: true,
    actions,
    mutations,
    state,
    getters
})
